/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.clbs.ex.springgwt.server.extractor;

import com.clbs.ex.springgwt.client.model.Post;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

/**
 *
 * @author peerawat.poombua
 */
public class PostExtractor implements ResultSetExtractor<Post> {

    public Post extractData(ResultSet rs) throws SQLException, DataAccessException {
        Post post = new Post();
        post.setPostID(rs.getInt("NPOSTID"));
        post.setMessage(rs.getString("CMESSAGE"));
        post.setCreationDate(rs.getTimestamp("DCREATIONDATE"));
        post.setIssueID(rs.getInt("NISSUEID"));
        return post;
    }
}
